/**
 * Created by lvliqi on 2016/7/12.
 */
/*
 急速幻影
 扫码
 提交图片
 hehe
 */

var express = require("express");
var router = express.Router();
var activity_enum = require("./activity_enum");
var status_enum = require("../status_enum");

var activityId = activity_enum.STROBO_PHOTO;

router.post("/link", function (req, res) {
    var url = req.body.url || req.query.url || "";

    var Queue = M("index.queue");

    Queue.update({
        images: url,
        status: status_enum.RESULT
    }, {
        where: {
            activityId: activityId
        }
    }).then(function () {
        res.json({
            errno: 0,
            url: url
        });
    }).catch(function (err) {
        res.json({
            errno: 10001,
            errdesc: err.message,
            url: url
        });
    });
});
module.exports = router;